#include <iostream>
#include <cmath>  // 引入数学库

using namespace std;

int main() {
    // 定义两个浮动数字
    double num1, num2;

    // 获取用户输入的两个数字
    cout << "请输入第一个数字: ";
    cin >> num1;
    cout << "请输入第二个数字: ";
    cin >> num2;

    // 计算加法、减法、乘法、除法
    double sum_result = num1 + num2;
    double difference = num1 - num2;
    double product = num1 * num2;

    // 检查除法是否为零
    double quotient;
    if (num2 != 0) {
        quotient = num1 / num2;
    } else {
        cout << "无法除以零！" << endl;
        quotient = 0; // 防止程序继续进行除零计算
    }

    // 计算平方根
    double sqrt_num1 = sqrt(num1);
    double sqrt_num2 = sqrt(num2);

    // 输出结果
    cout << "\n计算结果:" << endl;
    cout << num1 << " + " << num2 << " = " << sum_result << endl;
    cout << num1 << " - " << num2 << " = " << difference << endl;
    cout << num1 << " * " << num2 << " = " << product << endl;
    if (num2 != 0) {
        cout << num1 << " / " << num2 << " = " << quotient << endl;
    }
    cout << num1 << " 的平方根 = " << sqrt_num1 << endl;
    cout << num2 << " 的平方根 = " << sqrt_num2 << endl;

    return 0;
}

